import request from '@/apis/request';
import { useStore } from '@/store'
const store = useStore()
// 图片上传
export const fileUploadBase64Ex = (data?: Object) => {
    return request({
        url: "/business/api/file/fileUploadBase64Ex",
        method: "post",
        data
    });
}
// 身份证验证接口
export const idOrc = (data?: Object) => {
    return request({
        // url: "/assistanceWeixin/idOrc",
        url: "/business/api/baiduApi/idCard",
        method: "post",
        data
    });
}
// 获取新闻列表
export const getNewsApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getNews",
        method: "post",
        data
    });
}
// 获取新闻详情
export const getNewsDetailApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getNewsDetail",
        method: "post",
        data
    });
}
// 获取公告列表
export const getNoticeApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getNotice",
        method: "post",
        data
    });
}
// 获取公告详情
export const getAnnouncementContentApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getAnnouncementContent",
        method: "post",
        data
    });
}
// 业务咨询保存
export const getBusinessConsultingApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getBusinessConsulting",
        method: "post",
        data
    });
}
// 遗体接运预约车辆
export const getTransportVehicleApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getTransportVehicle",
        method: "post",
        data
    });
}
// 遗体接运预约服务项目
export const getTransportServiceApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getTransportService",
        method: "post",
        data
    });
}
// 遗体接运预约保存
export const appointmentSaveApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/appointmentSave",
        method: "post",
        data
    });
}
// 遗体接运预约查看
export const getRecordDetailsApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getRecordDetails",
        method: "post",
        data
    });
}

// 预约记录列表
export const getRecordApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getRecord",
        method: "post",
        data
    });
}
// 预约记录取消预约
export const getCancellationRecordApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getCancellationRecord",
        method: "post",
        data
    });
}
// 守灵预约获取守灵厅
export const getWakeHallApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getWakeHall",
        method: "post",
        data
    });
}
// 告别预约获取悼念厅
export const getMemorialHallApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getMemorialHall",
        method: "post",
        data
    });
}
// 告别预约获取布置要求
export const getMemorialFixApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getMemorialFix",
        method: "post",
        data
    });
}
// 告别预约获取服务项目
export const getMemorialServiceApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getMemorialService",
        method: "post",
        data
    });
}
// 告别预约获取时间段
export const getSubscribeNumberApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getSubscribeNumber",
        method: "post",
        data
    });
}
// 占用情况列表
export const getOccupancyApi = (data?: Object) => {
    return request({
        url: "/bygex/kmxWeiXin/getOccupancy",
        method: "post",
        data
    });
}
// 墓位查询列表
export const WSJSYTJApi = (data?: Object) => {
    return request({
        url: "/cemetery/fhs/print/WSJSYTJ",
        method: "post",
        data
    });
}
// 墓位查询信息
export const WXZFXFApi = (data?: Object) => {
    return request({
        url: "/cemetery/fhs/print/WXZFXF",
        method: "post",
        data
    });
}
// 续费记录
export const FHSXFJLApi = (data: Object) => {
    return request({
        url: "/cemetery/fhs/print/FHSXFJL",
        method: "post",
        data
    });
}
// 微信支付--暂时不对
// 1.获取access_token
export const weixinCgiBinAccessTokenApi = (params: Object) => {
    return request({
        url: "/cgi-bin/token",
        method: "get",
        params
    });
}
// 2.用第一步拿到的access_token 采用http GET方式请求获得jsapi_ticket（有效期7200秒，开发者必须在自己的服务全局缓存jsapi_ticket）
export const weixinGetticketApi = (params: Object) => {
    return request({
        url: "/cgi-bin/ticket/getticket",
        method: "get",
        params
    });
}

// JSApi下单
export const jsapiApi = (data: Object, Authorization) => {
    return request({
        url: "/v3/pay/transactions/jsapi",
        method: "post",
        headers: {
            Authorization,
            Accept: 'application/json',
            'Content-Type': 'application/json',
        },
        data
    });
}
export const wechatPayApi = (data: Object) => {
    return request({
        url: "/cemetery/fhs/print/wechatPay",
        method: "post",
        data
    });
}

// 微信
// 第二步：通过code换取网页授权access_token
// appid：公众号的唯一标识 secret：公众号的appsecret code：填写第一步获取的code参数 grant_type：填写为authorization_code
export const weixinAccessTokenApi = (params: Object) => {
    return request({
        // url: "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code",
        url: "/sns/oauth2/access_token",
        // url: '/sns/oauth2/access_token?appid=' + params.appid + '&secret=' + params.secret + '&code=' + params.code + '&grant_type=authorization_code',
        method: "get",
        params
    });
}
// 第三步：刷新access_token（如果需要）
// appid：公众号的唯一标识 grant_type：填写为refresh_token refresh_token：填写通过access_token获取到的refresh_token参数
export const weixinRefreshTokenApi = (params: Object) => {
    return request({
        url: "/sns/oauth2/refresh_token",
        method: "get",
        params
    });
}
// 第四步：拉取用户信息(需scope为 snsapi_userinfo)
// appid：公众号的唯一标识 grant_type：填写为refresh_token refresh_token：填写通过access_token获取到的refresh_token参数
export const weixinUserinfoApi = (params: Object) => {
    return request({
        url: "/sns/userinfo",
        method: "get",
        params
    });
}


// export const HTSJDApi = (data?: Object) => {
//     return request({
//         url: '/cemetery/lygrwy/print/HTSJD',
//         method: 'post',
//         data
//     });
// }

//云祭祀部分
export const cloudMemorialServiceLoginApi = (data?: Object) => {
    return request({
        url: '/cemetery/tomb/cloudMemorialServiceLogin',
        method: 'post',
        data
    })
}
export const fileUploadBase64Api = (data?: Object) => {
    // let data = {
    //     token: sessionStorage.getItem("token"),
    //     data: data,
    //     isJson: "Y"
    // }
    return request({
        url: '/business/api/file/fileUploadBase64',
        method: 'post',
        data
    })
}
// 建馆
export const createHallApi = (data?: Object) => {
    return request({
        url: '/cemetery/tomb/createHall',
        method: 'post',
        data
    })
}

// 网上祭祀建馆判断墓区匹配是否正确
// 传参子墓区ID gca_id   墓位编号gm_ex6  逝者姓名gcb_name
// 返回值code200进行保存操作
export const checkSavaApi = (data?: Object) => {
    return request({
        url: '/cemetery/tomb/checkSava',
        method: 'post',
        data
    })
}


// 网上祭祀
export const getHallFirend = (data?: object) => {
    return request({
        url: "/cemetery/tomb/getHallFirend",
        method: "post",
        data
    })
}

// 网上祭祀
export const checkPassword = (data?: object) => {
    return request({
        url: "/cemetery/tomb/checkPassword",
        method: "post",
        data
    })
}
// 网上祭祀
export const updateHallUser = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/updateHallUser",
        method: "post",
        data
    })
}
// 网上祭祀
export const getGiftInfo = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/getGiftInfo",
        method: "post",
        data
    })
}
// 网上祭祀
export const saveUserGift = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/saveUserGift",
        method: "post",
        data
    })
}

// 网上祭祀修改头像姓名
export const updateUserInfo = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/updateUserInfo",
        method: "post",
        data
    })
}
// 网上祭祀
export const updatePassword = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/updatePassword",
        method: "post",
        data
    })
}
// 网上祭祀
export const getPray = (data?: object) => {
    return request({
        url: "/cemetery/tomb/getPray",
        method: "post",
        data
    })
}
// 网上祭祀
export const changeImg = (data?: object) => {
    return request({
        url: "/cemetery/tomb/changeImg",
        method: "post",
        data
    })
}
// 网上祭祀
export const deleteHall = (data?: object) => {
    return request({
        url: "/cemetery/tomb/deleteHall",
        method: "post",
        data
    })
}
// 网上祭祀
export const fileUploadBase64 = (data?: object) => {
    let params = {
        // token: store.openid,
        data: data,
        isJson: "Y"
    }
    return request({
        url: "/business/api/file/fileUploadBase64",
        method: "post",
        data: params
    })
}
// 网上祭祀判断是否有权限设置
export const getUserInfo = (data?: object) => {
    return request({
        url: "/cemetery/cloudsacrifice/getUserInfo",
        method: "post",
        data
    })
}

// 正式接口
// 预约看墓
export const GmkmyuyApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/Gmkmyuy",
        method: "post",
        data
    })
}
// 预约安葬
export const GmazyuyApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/Gmazyuy",
        method: "post",
        data
    })
}
// 预约扫墓
export const GmsmyuyApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/Gmsmyuy",
        method: "post",
        data
    })
}
// 预约记录
export const GmwdyyApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/Gmwdyy",
        method: "post",
        data
    })
}

// 网上祭祀
export const getHallApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/getHall",
        method: "post",
        data
    })
}

//注册
export const saveUserApi = (data?: object) => {
    return request({
        url: "/api/api/loginWeixin/saveUser",
        method: "post",
        data
    })
}
// 登陆
export const checkLoginApi = (data?: object) => {
    return request({
        url: "/api/api/loginWeixin/checkLogin",
        method: "post",
        data
    })
}
// 网上祭祀保存头像
export const saveUserInfoApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/saveUserInfo",
        method: "post",
        data
    })
}
// 导航
export const FhsdaohApi = (data?: object) => {
    return request({
        url: "/cemetery/fhs/print/Fhsdaoh",
        method: "post",
        data
    })
}
